<?php
class MemberModel extends Model{
	// 自动验证设置
	protected $_validate	 =	 array(
	array('password','require','Password must be not null.'),
	array('age','number','Age must be not null.'),
	array('email','require','Email must be not null.'),
	array('email','email','Email format is incorrect'),
	array('repassword','require','Repassword must be not null.'),
	array('repassword','password','Confirm Password inconsistent.',self::EXISTS_VAILIDATE,'confirm'),
	array('email','','Email already exists.',0,'unique',self::MODEL_INSERT)
	);
	//自动填充设置
	public $_auto		=	array(
		array('password','pwdHash',self::MODEL_BOTH,'callback'),
		array('disabled', 0),
		array('create_time','get_client_time',self::MODEL_INSERT,'function'),
		array('login_time','get_client_time',self::MODEL_BOTH,'function'),//user operate
		array('update_time','get_client_time',self::MODEL_BOTH,'function'),
		array("login_ip","get_client_ip",self::MODEL_BOTH,"function"),
	);
	protected function pwdHash() {
		if(isset($_POST['password'])) {
			return pwdHash($_POST['password']);
		}else{
			return false;
		}
	}
}

?>